// 引入封装的 axios
import axios from './axios'

// 根据 id 获取广告位及其对应广告
export const getAllAds = spaceKeys => {
  return axios({
    method: 'get',
    url: `/front/ad/getAllAds?spaceKeys=${spaceKeys}`
  })
}

// 分页查询课程信息
export const getQueryCourses = data => {
  return axios({
    method: 'post',
    url: '/boss/course/getQueryCourses',
    data
  })
}

// 获取已购课程
export const getPurchaseCourse = () => {
  return axios({
    method: 'get',
    url: '/front/course/getPurchaseCourse'
  })
}

// 获取课程详情
export const getCourseById = courseId => {
  return axios({
    method: 'get',
    url: '/front/course/getCourseById',
    params: {
      courseId
    }
  })
}

// 获取课程章节
export const getSectionAndLesson = courseId => {
  return axios({
    method: 'get',
    url: '/front/course/session/getSectionAndLesson',
    params: {
      courseId
    }
  })
}

// 获取阿里云视频播放信息
export const videoPlayInfo = lessonId => {
  return axios({
    method: 'get',
    url: '/front/course/media/videoPlayInfo',
    params: {
      lessonId
    }
  })
}
